﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using WeifenLuo.WinFormsUI.Docking;
namespace Paros.Win
{
    public partial class NewForm : DockContent
    {
        public NewForm()
        {
            InitializeComponent();
            
        }

        public HTMLEditor.Editor Editor
        {
            get
            {
                return this.editor1;
            }
            set
            {
                editor1 = value;
            }
        }

        public int ID { get; set; }
        public string Title
        {
            get
            {
                return tbTitle.Text;
            }
            set
            {
                tbTitle.Text = value;
            }
        }

        public string Category
        {
            get
            {
                return tbCategory.Text;
            }

            set
            {
                tbCategory.Text = value;
            }
        }

        private void editor1_OnChanged(object sender, EventArgs e)
        {
            ((mainForm)this.TopLevelControl).OnDocumentChanged();
        }

        private void editor1_OnDocumentSaving(object sender, EventArgs e)
        {
            ((mainForm)this.TopLevelControl).OnDocumentSaving();
        }

        private void tbTitle_TextChanged(object sender, EventArgs e)
        {
            if(this.TopLevelControl.GetType() == typeof(mainForm))
                ((mainForm)this.TopLevelControl).OnDocumentChanged();
        }
    }
}
